//
//  PlayerCenterView.swift
//  FirstSwiftProduct
//
//  Created by 知合金服-Mini on 2017/12/20.
//  Copyright © 2017年 范泽华. All rights reserved.
//

import UIKit

class PlayerCenterView: UIView {

    
    var nameLabel :UILabel!
    var albumView :UIImageView!
    
    var lyricsLabel : UILabel!
    
    let count = 3
    let btnTitle = ["标准","MV","音效"]
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        nameLabel = UILabel.init(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 40))
        self.addSubview(nameLabel)
        nameLabel.textAlignment = .center
        nameLabel.text = "-- 周杰伦 --"
        let B_width:CGFloat = 60
        
        for i in 0...(count - 1) {
            let button = UIButton.init(type: .system)
            let centerX:CGFloat = self.frame.size.width / 2
            
            button.frame = CGRect(x: (centerX - (B_width/2) - B_width) + (B_width + 5) * CGFloat(i), y: 40, width: B_width, height: 20)
            button.setTitle(btnTitle[i], for: .normal)
            button.layer.borderWidth = 1
            button.layer.borderColor = UIColor.red.cgColor
            button.layer.cornerRadius  = 2
            self.addSubview(button)
        }
        
        albumView = UIImageView.init(frame: CGRect(x: 20, y: 65, width: self.width - 40, height: self.width - 40))
        albumView.image = UIImage.init(named: "father")
        albumView.layer.borderWidth = 5
        albumView.layer.borderColor = UIColor.gray.cgColor
        albumView.layer.cornerRadius = (self.width - 40) / 2
        albumView.layer.masksToBounds = true
//        albumView.layer.contents = UIImage.init(named: "father")
        self.addSubview(albumView)
        
        lyricsLabel = UILabel.init(frame: CGRect(x: 0, y: 70 + self.width - 40 , width: self.width, height: 20))
        lyricsLabel.text = "待恶人太善，待善人太恶。"
        lyricsLabel.textAlignment = .center
        self.addSubview(lyricsLabel)
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
